package com.cyandpos.pad.querygoods.presenter;


import com.cyandpos.pad.querygoods.model.QueryGoodsModel;
import com.cyandpos.pad.querygoods.model.QueryGoodsModelImpl;
import com.cyandpos.pad.querygoods.view.QueryGoodsView;
import com.cyandpos.pad.posdata.Goods;

public class QueryGoodsPresenterImpl implements QueryGoodsPresenter,QueryGoodsModelImpl.OnLoadQueryGoodsListener{
    private QueryGoodsView mQueryGoodsView;
    private QueryGoodsModel mQueryGoodsModel;
    public QueryGoodsPresenterImpl(QueryGoodsView mQueryGoodsView){
        this.mQueryGoodsView = mQueryGoodsView;
        mQueryGoodsModel = new QueryGoodsModelImpl();

    }

    @Override
    public void QueryGoods(String goodsCode,String personDeptId) {

        mQueryGoodsView.showProgress();
        mQueryGoodsModel.loadQueryGoods(goodsCode,personDeptId,this);

    }


    @Override
    public void onLoadQueryGoodsSuccess(Goods goods) {
        mQueryGoodsView.hideProgress();
        mQueryGoodsView.onQueryGoodsSuccess(goods);

    }

    @Override
    public void onLoadQueryGoodsFailure(String errorMsg) {
        //model 网络请求失败
        mQueryGoodsView.hideProgress();
        mQueryGoodsView.showLoadFailMsg(errorMsg);

    }
}
